package com.yykj.tencent.im.client.feign;

import com.yykj.tencent.im.client.fallback.TencentImFallbackFactory;
import com.yykj.tencent.im.client.form.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.List;

@FeignClient(name = "tencent-im-server", fallbackFactory = TencentImFallbackFactory.class)
public interface TencentImFeignClient {

    @ApiOperation("创建群组")
    @GetMapping("/api/tencent/im/group/create")
    @Deprecated
    CreateGroupResult create(@RequestParam(name = "ownerAccount") String ownerAccount,
                             @RequestParam(name = "type", required = false) String type,
                             @RequestParam(name = "name") String name,
                             @RequestParam(name = "faceUrl") String faceUrl);

    @ApiOperation("创建群组")
    @PostMapping("/api/tencent/im/group/create")
    CreateGroupResult create(@RequestBody CreateGroupForm body);


    @ApiOperation("在群组中发送普通消息")
    @PostMapping("/api/tencent/im/group/send/message")
    SendGroupMsgResult sendGroupMsg(@RequestBody SendGroupMsgRequest body);

    @ApiOperation("发送系统消息")
    @PostMapping("/api/tencent/im/system/message/send")
    SendMsgResult sendSystemMsg(@RequestBody SendSystemMsgRequest body);

    @ApiOperation("设置账号资料")
    @PostMapping("/api/tencent/im/profile/set")
    PortraitSetResult setProfile(@RequestBody UserProfileForm body);

    @ApiOperation("增加群成员")
    @PostMapping("/api/tencent/im/group/member/add")
    AddGroupMemberResult memberAdd(@RequestBody AddGroupMemberForm body);

    @ApiOperation("删除群成员")
    @PostMapping("/api/tencent/im/group/member/delete")
    DeleteGroupMemberResult memberDelete(@RequestBody DeleteGroupMemberForm body);

    @ApiOperation("我的好友")
    @GetMapping("/api/tencent/im/friend/me")
    List<ContactDTO> myFriends(@RequestParam String fromAccount);

    @ApiOperation("群发系统消息")
    @PostMapping("/api/tencent/im/system/message/batchSend")
    SendMsgResult batchSendSystemMsg(@RequestBody BatchSendSystemMsgRequest body);

    @ApiOperation("群发发送自定义消息")
    @PostMapping("/api/tencent/im/system/message/batchSendCustomMsg")
    SendMsgResult batchSendCustomMsg(@RequestBody @Valid BatchSendSystemMsgRequest body);

    @ApiOperation("tpns推送")
    @PostMapping("/api/tencent/tpns/send")
    void tpnsSend(@RequestBody TpnsSendForm tpnsSendForm);
}
